package edu.umn.contactviewer;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * The home screen of the application.
 * 
 */
public class HomeActivity extends Activity implements OnClickListener {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		findViewById(R.id.contacts_button).setOnClickListener(this);

		findViewById(R.id.about_button).setOnClickListener(this);
	}

	public void onClick(View v) {
		if (v.getId() == R.id.contacts_button) {
			Intent intent = new Intent(this, ContactListActivity.class);
			startActivity(intent);
		} else if (v.getId() == R.id.about_button) {
			AlertDialog.Builder builder = new AlertDialog.Builder(this);
			builder.setMessage(
					"The Contact Viewer was designed in for SENG 5199-1: Mobile Application Development by Team iDroid")
					.setCancelable(false)
					.setPositiveButton("OK",
							new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dialog,
										int id) {

								}
							});

			AlertDialog alert = builder.create();
			alert.show();

		}
	}
}